

//
//  YDUnBindBankCell.m
//  PeiZiWangBei
//
//  Created by 巨彦新 on 2018/1/4.
//  Copyright © 2018年 LK-IOS. All rights reserved.
//

#import "YDUnBindBankCell.h"

@interface YDUnBindBankCell ()

@property (nonatomic, strong)UILabel *title; //持卡人

@property (nonatomic, strong)UILabel *detail; //姓名

@property (nonatomic, strong)UILabel *line;



@end

@implementation YDUnBindBankCell

+ (instancetype)cellWithTableView:(UITableView *)tableview
{
    static NSString *const PZUnBindBankCellID = @"BankListCell";
    
    YDUnBindBankCell *cell = [tableview dequeueReusableCellWithIdentifier:PZUnBindBankCellID];
    
    if (cell == nil) {
        cell = [[YDUnBindBankCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:PZUnBindBankCellID];
        
    }
    return cell;
}

-(void)cellWithModel:(YDBankCardModel *)cardModel index:(NSInteger)index
{
    switch (index) {
        case 0:
            self.title.text = @"持卡人";
            self.detail.text = cardModel.name;
            break;
        case 1:
            self.title.text = @"支行信息";
            self.detail.text = cardModel.branchName;
            break;
        case 2:
            self.title.text = @"预留电话";
            self.detail.text = cardModel.phone;
            break;
        default:
            break;
    }
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        self.backgroundColor = NumberColor(255, 255, 255);
        
        [self title];
        [self detail];
        [self line];

        
    }
    return self;
}


-(UILabel *)title
{
    if (_title == nil) {
        _title = [UILabel new];
        [self.contentView addSubview:_title];
        [_title mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(@(rate375(18)));
            make.centerY.equalTo(self.contentView);
        }];
        _title.font = [UIFont systemFontOfSize:font14ScreenWRate *LKScreenW];
        _title.textColor = [UIColor lightGrayColor];
    }
    return _title;
}

-(UILabel *)detail
{
    if (_detail == nil) {
        _detail = [UILabel new];
        [self.contentView addSubview:_detail];
        [_detail mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView).offset(rate375(100));
            make.centerY.equalTo(self.contentView);
            make.width.equalTo(@(LKScreenW - rate375(118)));
        }];
        _detail.font = [UIFont systemFontOfSize:font14ScreenWRate *LKScreenW];
  
    }
    return _detail;
}

-(UILabel *)line
{
    if (_line == nil) {
        _line = [UILabel new];
        [self.contentView addSubview:_line];
        [_line mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(_title.mas_left);
            make.right.equalTo(@(-rate375(18)));
            make.bottom.equalTo(self.contentView).offset(-1);
            make.height.equalTo(@1);
        }];
        _line.backgroundColor = [UIColor colorWithHexString:mainGray];
        
    }
    return _line;
}
@end
